/**
 * 
 */
package in.ac.iitb.cse.nlp.postagger.data;

import java.util.List;

/**
 * @author zerone
 *
 */
public abstract class  HMM {
	TransitionMatrix tm = null;
	EmissionMatrix em = null;
	List<String > tagset = null;
	List <String> bestTagSeq = null;
	List<String> sentence = null;
	protected int nTags, nWords;
	
	public void init (List<String> Tagset, TransitionMatrix tm, EmissionMatrix em) {
		this.tm = tm;
		this.em = em;
		tagset = Tagset;
		nTags = tagset.size();
	}
	public void checkSentence()
	{
		int s = 0;
		if(sentence == null) return;
		s = sentence.size();
		if(sentence.get(0).equalsIgnoreCase("^") ==false ) sentence.add(0, "^");
		if(sentence.get(s-1).equalsIgnoreCase("$") ==false ) sentence.add("$");
 	}
	public void makeSeq() 
	{
		int s = 0;
		if(bestTagSeq == null) return;
		s = bestTagSeq.size();
		//System.out.println(sentence.toString());
		//System.out.println(bestTagSeq.toString());
		for(int i=s-1;i>=0;i--)
		{
			//TODO
//			if(bestTagSeq.get(i).equalsIgnoreCase("$") || sentence.get(i).equalsIgnoreCase("$")) {
			if(bestTagSeq.get(i).equalsIgnoreCase("$")) {
				bestTagSeq.remove(i);
			}
			if(sentence.get(i).equalsIgnoreCase("$")) {
				sentence.remove(i);
			}
		}
		//TODO
//		while ( bestTagSeq.get(0).equalsIgnoreCase("^") || sentence.get(0).equalsIgnoreCase("^") )
		while (bestTagSeq.size()>0&&bestTagSeq.get(0).equalsIgnoreCase("^")  )
		{
			bestTagSeq.remove(0);
		}
		while ( sentence.size()>0&&sentence.get(0).equalsIgnoreCase("^")  )
		{
			sentence.remove(0);
		}
	}
	public int preProcessInputWord(int index, List<String> Sentence){return 0;}
	public List<String> bestProbTagSeq( List<String> Sentence){return null;}
	public Double ProbTagSeq(List<String> Tagseq, List<String> Sentence){return 0.0;}
	public Tag handleUnknownWord(int index){return null;}
}
